/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.suspend.floatwindow.floattingicon;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.OvershootInterpolator;
import android.view.animation.RotateAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
import com.qihoo.gamecenter.sdk.suspend.b.e.e;
import com.qihoo.gamecenter.sdk.suspend.floatwindow.floattingicon.a.a.b;
import com.qihoo.gamecenter.sdk.suspend.floatwindow.layout.GameunionFloatingIconLayout;
import com.qihoo.gamecenter.sdk.suspend.floatwindow.layout.GameunionFloatingIconMenu;
import com.qihoo.gamecenter.sdk.suspend.floatwindow.layout.GameunionFloatingIconMoreMenu;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

@SuppressLint({ "HandlerLeak" })
public class a implements View.OnTouchListener {
    private static volatile a a = null;
    private Context b;
    private WindowManager c;
    private Point d = new Point();
    private int e = 0;
    private c f;
    private c g = new c() {
        public void a(c.a parama) {
            if (a.a(a.this) == 51)
                a.a(a.this, 61);
            else if (a.a(a.this) == 52)
                a.a(a.this, 62);
            if (a.b(a.this) == null)
                return;
            a.b(a.this).a(parama);
        }

        public void a(int paramInt) {
            if (a.b(a.this) == null)
                return;
            a.b(a.this).a(paramInt);
        }
    };
    private View h;
    private WindowManager.LayoutParams i;
    private RotateIconView j;
    private View k;
    private ImageView l;
    private View m;
    private WindowManager.LayoutParams n;
    private MenuIconManager o;
    private View p;
    private WindowManager.LayoutParams q;
    private MoreMenuIconManager r;
    private List s = null;
    private Point t = null;
    private int u = 11;
    private long v = 0L;
    private long w = 0L;
    private float x = 1.0F;
    private long y = 0L;
    private boolean z = false;
    private boolean A = true;
    private long B = 0L;
    private a C = new a();
    private a D = new a();
    private Timer E = null;
    private TimerTask F = null;
    private com.qihoo.gamecenter.sdk.suspend.floatwindow.floattingicon.a.a G = null;
    private c.a H = null;
    private c I = new c() {
        public void a(c.a parama) {
            a.c(a.this);
            a(4);
            com.qihoo.gamecenter.sdk.suspend.b.a.a("360FloatSdk_click_more", com.qihoo.gamecenter.sdk.suspend.remote.b
                    .b().c(), a.d(a.this));
        }

        public void a(int paramInt) {
            if (a.b(a.this) == null)
                return;
            a.b(a.this).a(paramInt);
        }
    };
    private Handler J = new Handler() {
        public void handleMessage(Message paramMessage) {
            if (paramMessage.what == 1) {
                a.e(a.this);
                a.f(a.this);
                a.g(a.this);
                if ((a.h(a.this) != null) && (a.a(a.this) == 40))
                    a.h(a.this).a();
                a.i(a.this);
                a.j(a.this);
                a.k(a.this);
            }
            super.handleMessage(paramMessage);
        }
    };
    private boolean K = false;

    public static a a(Context paramContext) {
        if (a != null)
            return a;
        if (paramContext == null)
            return null;
        if (a == null)
            a = new a(paramContext);
        return a;
    }

    public a(Context paramContext) {
        this.b = paramContext;
    }

    private void e() {
        this.e = (d.a(this.b) / 2);
        DisplayMetrics localDisplayMetrics = new DisplayMetrics();
        localDisplayMetrics = this.b.getResources().getDisplayMetrics();
        if (this.d == null)
            this.d = new Point();
        this.d.x = localDisplayMetrics.widthPixels;
        this.d.y = localDisplayMetrics.heightPixels;
        this.c = ((WindowManager) this.b.getApplicationContext().getSystemService("window"));
        this.i = g();
        this.i.width = (this.i.height = d.c(this.b));
        int i1 = 0 - this.e;
        if (this.t == null) {
            this.i.x = i1;
            this.i.y = i1;
        }
        else {
            this.i.x = this.t.x;
            this.i.y = this.t.y;
        }
        if ((this.i.x < i1) || (this.i.x > this.d.x))
            this.i.x = i1;
        if ((this.i.y < i1) || (this.i.y > this.d.y))
            this.i.y = i1;
        f();
        h();
    }

    private void f() {
        if (this.F == null)
            this.F = new TimerTask() {
                public void run() {
                    if ((a.l(a.this) == null) || (a.l(a.this).getVisibility() != 0))
                        return;
                    a.m(a.this).sendEmptyMessage(1);
                }
            };
        if (this.E != null)
            return;
        this.E = new Timer();
        this.E.schedule(this.F, 1000L, 30L);
    }

    private WindowManager.LayoutParams g() {
        WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams(-1, -1, 2003, 552, -2);
        localLayoutParams.gravity = 51;
        localLayoutParams.x = 0;
        localLayoutParams.y = 0;
        localLayoutParams.format = 1;
        return localLayoutParams;
    }

    private void h() {
        this.h = new GameunionFloatingIconLayout(this.b);
        this.k = this.h.findViewById(com.qihoo.gamecenter.sdk.suspend.d.b.b);
        this.j = ((RotateIconView) this.h.findViewById(com.qihoo.gamecenter.sdk.suspend.d.b.c));
        this.j.a(this);
        l();
        if (this.h == null)
            return;
        this.l = ((ImageView) this.h.findViewById(com.qihoo.gamecenter.sdk.suspend.d.b.d));
    }

    private void i() {
        if ((this.k == null) || (this.n != null) || (this.m != null))
            return;
        this.n = g();
        this.m = new GameunionFloatingIconMenu(this.b);
        this.o = ((MenuIconManager) this.m.findViewById(com.qihoo.gamecenter.sdk.suspend.d.b.f));
        this.o.setVisibility(8);
        this.o.a(this, this.s, this.H, this.g, this.I);
        int i1 = this.o.a(this.k.getHeight(), this.k.getWidth());
        this.n.width = (i1 + this.k.getWidth());
        this.n.height = this.k.getHeight();
        this.c.addView(this.m, this.n);
    }

    private void j() {
        if (this.G == null)
            this.G = new com.qihoo.gamecenter.sdk.suspend.floatwindow.floattingicon.a.a(this.b);
        this.G.a(new a.b() {
            public void a() {
                a.this.a();
            }

            public void b() {}
        });
        try {
            this.G.a();
        } catch (Throwable localThrowable) {
            localThrowable.printStackTrace();
        }
    }

    public void a(List paramList, c.a parama, c paramc) {
        if (this.h != null)
            a();
        synchronized (a.class) {
            if (e.a(paramList))
                return;
            j();
            com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "menu size=" + paramList.size());
            this.s = paramList;
            this.f = paramc;
            this.H = parama;
            e();
            if (this.d == null)
                this.d = new Point();
            if (this.i == null)
                this.i = g();
            if (this.i.x <= this.d.x / 2)
                this.u = 11;
            else
                this.u = 12;
            this.c.addView(this.h, this.i);
            if (this.k != null)
                this.k.setOnTouchListener(this);
        }
    }

    private void k() {
        if (this.i == null)
            return;
        if (this.t == null)
            this.t = new Point();
        this.t.x = this.i.x;
        this.t.y = this.i.y;
    }

    public void a() {
        synchronized (a.class) {
            k();
            if (this.G != null) {
                try {
                    this.G.b();
                } catch (Throwable localThrowable1) {
                    localThrowable1.printStackTrace();
                }
                this.G = null;
            }
            if (this.E != null)
                this.E.cancel();
            try {
                if (this.j != null)
                    this.j.b();
                if (this.p != null)
                    this.c.removeView(this.p);
                if (this.m != null)
                    this.c.removeView(this.m);
                if ((this.h != null) && (this.c != null))
                    this.c.removeView(this.h);
            } catch (Throwable localThrowable2) {
                localThrowable2.printStackTrace();
            }
            this.m = null;
            this.h = null;
            this.h = null;
            this.k = null;
            this.j = null;
            this.o = null;
            this.i = null;
            this.n = null;
            this.c = null;
            this.d = null;
            this.E = null;
            this.F = null;
            this.z = false;
            this.A = true;
            this.v = 0L;
            this.w = 0L;
            this.y = 0L;
            this.H = null;
            this.p = null;
            this.r = null;
            this.q = null;
        }
    }

    public void a(int paramInt1, int paramInt2) {
        if ((this.h == null) || (this.d == null))
            return;
        if ((this.h.getHeight() <= 0) || (this.h.getWidth() <= 0))
            return;
        int i1 = this.h.getWidth();
        int i2 = this.d.x;
        int i3 = i2 - i1;
        this.i.x = (paramInt1 - (this.h.getWidth() / 2));
        this.i.y = (paramInt2 - (int) (this.h.getHeight() * 1.2F));
        if (this.i.x > i3)
            this.i.x = i3;
        else if (this.i.x < 0)
            this.i.x = 0;
        if (this.i.y > this.d.y)
            this.i.y = this.d.y;
        else if (this.i.y < 0 - this.e)
            this.i.y = (0 - this.e);
        com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "mBaseParams.x=" + this.i.x
                + " mBaseParams.y=" + this.i.x);
        this.c.updateViewLayout(this.h, this.i);
    }

    public boolean onTouch(View paramView, MotionEvent paramMotionEvent) {
        int i1 = paramMotionEvent.getAction();
        switch (i1 & 0xFF) {
        case 0:
            this.B = System.currentTimeMillis();
            this.C.a = paramMotionEvent.getRawX();
            this.C.b = paramMotionEvent.getRawY();
            this.D.a = paramMotionEvent.getRawX();
            this.D.b = paramMotionEvent.getRawY();
            break;
        case 1:
        case 3:
            this.D.a = paramMotionEvent.getRawX();
            this.D.b = paramMotionEvent.getRawY();
            o();
            this.B = 0L;
            this.C.a = (this.C.b = this.D.a = this.D.b = 0.0F);
            break;
        case 2:
            this.D.a = paramMotionEvent.getRawX();
            this.D.b = paramMotionEvent.getRawY();
            if ((a(this.B, this.C, this.D)) || (d()) || (c(this.B, this.C, this.D)) || (b(this.B, this.C, this.D)))
                break label249;
            n();
        }
        label249: return false;
    }

    private boolean b(long paramLong, a parama1, a parama2) {
        if ((this.u == 31) || (this.u == 32))
            return true;
        if ((this.u != 21) && (this.u != 22))
            return false;
        if (this.u == 21)
            if (parama2.a <= parama1.a)
                return false;
            else if (parama2.a >= parama1.a)
                return false;
        if (this.u == 21)
            this.u = 31;
        else
            this.u = 32;
        return true;
    }

    private boolean c(long paramLong, a parama1, a parama2) {
        if ((this.u == 21) || (this.u == 22)) {
            if (this.u == 21)
                return (parama2.a < parama1.a);
            return (parama2.a > parama1.a);
        }
        if ((this.u != 11) && (this.u != 12))
            return false;
        long l1 = System.currentTimeMillis();
        long l2 = l1 - paramLong;
        float f1 = Math.abs(parama2.a - parama1.a);
        if (f1 < 10.0F)
            return false;
        if (this.u == 11)
            if (parama2.a >= parama1.a)
                return false;
            else if (parama2.a <= parama1.a)
                return false;
        if (l2 > 700L)
            return false;
        this.z = false;
        if (this.u == 11)
            this.u = 21;
        else
            this.u = 22;
        com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "cutTime=" + String.valueOf(l2) + " cutX="
                + String.valueOf(f1));
        return true;
    }

    public static boolean a(long paramLong, a parama1, a parama2) {
        long l1 = System.currentTimeMillis();
        long l2 = l1 - paramLong;
        float f1 = Math.abs(parama2.a - parama1.a);
        float f2 = Math.abs(parama2.b - parama1.b);
        com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "cutTime=" + String.valueOf(l2) + " cutX="
                + String.valueOf(f1) + " cutY" + String.valueOf(f2));
        if ((l2 <= 200L) && (f1 <= 10.0F) && (f2 <= 10.0F)) {
            com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "mMoveAction = ACTION_CLICK");
            return true;
        }
        return false;
    }

    private void l() {
        com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "stopRotateAnimation");
        if (this.j == null)
            return;
        this.j.setVisibility(8);
    }

    private void m() {
        com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "startRotateAnimation");
        if (this.j == null)
            return;
        this.u = 40;
        this.j.setVisibility(0);
    }

    private void n() {
        a(1.0F);
        m();
        a((int) this.D.a, (int) this.D.b);
    }

    private void o() {
        l();
        if (a(this.B, this.C, this.D)) {
            com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "mMoveAction = ACTION_CLICK");
            b();
            return;
        }
        if (c(this.B, this.C, this.D)) {
            com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr",
                    "mMoveAction = ANI_HIDE_EDGE_LEFT ANI_HIDE_EDGE_RIGHT");
            return;
        }
        if (b(this.B, this.C, this.D)) {
            com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr",
                    "mMoveAction = ANI_SHOW_EDGE_LEFT ANI_SHOW_EDGE_RIGHT");
            return;
        }
        if (this.u != 40)
            return;
        p();
    }

    private void p() {
        if ((this.i == null) || (this.h == null) || (this.d == null) || (this.u != 40))
            return;
        int i1 = this.h.getWidth();
        int i2 = this.d.x;
        int i3 = 0 - this.e;
        int i4 = i2 - i1 + this.e;
        if (this.i.x == i3) {
            this.u = 11;
            return;
        }
        if (this.i.x == i4) {
            this.u = 12;
            return;
        }
        int i5 = this.i.x;
        int i6 = i2 - i5 - i1;
        this.u = 11;
        int i7 = i5;
        if (i7 <= i6)
            return;
        this.u = 12;
        i7 = i6;
    }

    private void q() {
        if (this.v == 0L)
            this.v = System.currentTimeMillis();
        if (this.w == 0L)
            this.w = System.currentTimeMillis();
        if (this.y == 0L)
            this.y = System.currentTimeMillis();
        long l1;
        if ((this.u == 11) || (this.u == 12)) {
            l1 = System.currentTimeMillis();
            if (l1 - this.v >= 15000L) {
                this.z = false;
                if (this.u == 11)
                    this.u = 21;
                else if (this.u == 12)
                    this.u = 22;
            }
            if (l1 - this.v >= 2000L)
                a(0.5F);
        }
        else {
            this.v = System.currentTimeMillis();
            this.y = System.currentTimeMillis();
        }
        if ((((this.u == 51) || (this.u == 52))) && (v())) {
            l1 = System.currentTimeMillis();
            if (l1 - this.w < 10000L)
                return;
            if (this.u == 51) {
                this.u = 61;
                a(3);
            }
            else {
                if (this.u != 52)
                    return;
                this.u = 62;
                a(3);
            }
        }
        else {
            this.w = System.currentTimeMillis();
        }
    }

    private void r() {
        if (((this.u != 21) && (this.u != 22)) || (this.z) || (this.k == null) || (this.i == null) || (this.d == null)
                || (this.c == null) || (this.h == null))
            return;
        a(1.0F);
        this.z = true;
        this.k.clearAnimation();
        int i1 = 0;
        float f1 = 0.0F;
        if (this.u == 21) {
            i1 = 0 - this.k.getWidth();
            f1 = -720.0F;
        }
        else {
            i1 = this.k.getWidth();
            f1 = 720.0F;
        }
        RotateAnimation localRotateAnimation = new RotateAnimation(0.0F, f1, 1, 0.5F, 1, 0.5F);
        localRotateAnimation.setDuration(400L);
        TranslateAnimation localTranslateAnimation = new TranslateAnimation(0.0F, i1, 0.0F, 0.0F);
        localTranslateAnimation.setInterpolator(new DecelerateInterpolator());
        localTranslateAnimation.setDuration(400L);
        AnimationSet localAnimationSet = new AnimationSet(false);
        localAnimationSet.addAnimation(localRotateAnimation);
        localAnimationSet.addAnimation(localTranslateAnimation);
        localAnimationSet.setFillAfter(true);
        localAnimationSet.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation paramAnimation) {}

            public void onAnimationRepeat(Animation paramAnimation) {}

            public void onAnimationEnd(Animation paramAnimation) {
                if ((a.l(a.this) == null) || (a.n(a.this) == null) || (a.o(a.this) == null) || (a.p(a.this) == null)
                        || (a.q(a.this) == null))
                    return;
                int i = a.l(a.this).getWidth();
                int j = a.o(a.this).x;
                int k = (int) (i * 0.285714F);
                FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(a.n(a.this).getWidth(), a.n(
                        a.this).getHeight());
                localLayoutParams.gravity = 51;
                if (a.a(a.this) == 21) {
                    a.p(a.this).x = (0 - (i - k));
                    localLayoutParams.leftMargin = (0 - i);
                }
                else {
                    a.p(a.this).x = (j - k);
                    localLayoutParams.leftMargin = i;
                }
                a.n(a.this).setLayoutParams(localLayoutParams);
                a.q(a.this).updateViewLayout(a.l(a.this), a.p(a.this));
                a.r(a.this);
            }
        });
        this.k.startAnimation(localAnimationSet);
    }

    private void s() {
        this.k.clearAnimation();
        int i1 = this.k.getWidth();
        int i2 = 0;
        if (this.u == 21)
            i2 = i1;
        else
            i2 = 0 - i1;
        TranslateAnimation localTranslateAnimation = new TranslateAnimation(0.0F, i2, 0.0F, 0.0F);
        localTranslateAnimation.setInterpolator(new OvershootInterpolator());
        localTranslateAnimation.setDuration(300L);
        AnimationSet localAnimationSet = new AnimationSet(false);
        localAnimationSet.addAnimation(localTranslateAnimation);
        localAnimationSet.setFillAfter(true);
        localAnimationSet.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation paramAnimation) {}

            public void onAnimationRepeat(Animation paramAnimation) {}

            public void onAnimationEnd(Animation paramAnimation) {
                if (a.n(a.this) == null)
                    return;
                FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(a.n(a.this).getWidth(), a.n(
                        a.this).getHeight());
                localLayoutParams.gravity = 51;
                localLayoutParams.leftMargin = 0;
                a.n(a.this).setLayoutParams(localLayoutParams);
                a.n(a.this).clearAnimation();
                a.a(a.this, false);
            }
        });
        this.k.startAnimation(localAnimationSet);
    }

    public void b() {
        if (this.K)
            return;
        com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "doIconClick");
        com.qihoo.gamecenter.sdk.suspend.b.a.a("360FloatSdk_click_view", com.qihoo.gamecenter.sdk.suspend.remote.b.b()
                .c(), this.b);
        if (this.u == 21) {
            this.u = 31;
            a(1.0F);
        }
        else if (this.u == 22) {
            this.u = 32;
            a(1.0F);
        }
        else if ((v()) && (this.u == 11)) {
            this.u = 51;
            a(1);
        }
        else if ((v()) && (this.u == 12)) {
            this.u = 52;
            a(1);
        }
        else if ((v()) && (this.u == 51)) {
            this.u = 61;
            a(2);
        }
        else {
            if ((!(v())) || (this.u != 52))
                return;
            this.u = 62;
            a(2);
        }
    }

    public void c() {
        if ((v()) && (this.u == 51)) {
            this.u = 61;
            a(2);
        }
        else {
            if ((!(v())) || (this.u != 52))
                return;
            this.u = 62;
            a(2);
        }
    }

    private void t() {
        if ((this.u != 11) && (this.u != 12)) {
            this.K = false;
            return;
        }
        if ((this.i == null) || (this.d == null) || (this.c == null) || (this.h == null)) {
            this.K = false;
            return;
        }
        int i1 = this.h.getWidth();
        int i2 = this.d.x;
        int i3 = 0 - this.e;
        int i4 = i2 - i1 + this.e;
        if (this.i.x == i3) {
            this.K = false;
            return;
        }
        if (this.i.x == i4) {
            this.K = false;
            return;
        }
        this.K = true;
        com.qihoo.gamecenter.sdk.suspend.b.b.a("GameUnionFloatingIconMgr", "doEdgeAnimation");
        switch (this.u) {
        case 11:
            this.i.x -= 20;
            if (this.i.x < i3)
                this.i.x = i3;
            break;
        case 12:
            this.i.x += 20;
            if (this.i.x > i4)
                this.i.x = i4;
        }
        this.c.updateViewLayout(this.h, this.i);
    }

    private void u() {
        if (((this.u != 31) && (this.u != 32)) || (this.A))
            return;
        a(1.0F);
        this.A = true;
        this.k.clearAnimation();
        int i1 = this.h.getWidth();
        int i2 = this.d.x;
        int i3 = (int) (i1 * 0.285714F);
        if (this.u == 31)
            this.i.x = (0 - this.e);
        else
            this.i.x = (i2 - i1 + this.e);
        FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(this.k.getWidth(), this.k.getHeight());
        localLayoutParams.gravity = 51;
        if (this.u == 31)
            localLayoutParams.leftMargin = (0 - (i1 - i3));
        else
            localLayoutParams.leftMargin = (i1 - i3);
        this.k.setLayoutParams(localLayoutParams);
        this.c.updateViewLayout(this.h, this.i);
        float f1 = 0.0F;
        float f2 = 0.0F;
        if (this.u == 31) {
            i3 = i1 - i3;
            f1 = 180.0F;
            f2 = 360.0F;
        }
        else {
            i3 = 0 - (i1 - i3);
            f1 = -180.0F;
            f2 = -360.0F;
        }
        RotateAnimation localRotateAnimation = new RotateAnimation(f1, f2, 1, 0.5F, 1, 0.5F);
        localRotateAnimation.setDuration(500L);
        TranslateAnimation localTranslateAnimation = new TranslateAnimation(0.0F, i3, 0.0F, 0.0F);
        localTranslateAnimation.setInterpolator(new OvershootInterpolator());
        localTranslateAnimation.setDuration(500L);
        AnimationSet localAnimationSet = new AnimationSet(false);
        localAnimationSet.addAnimation(localRotateAnimation);
        localAnimationSet.addAnimation(localTranslateAnimation);
        localAnimationSet.setFillAfter(true);
        localAnimationSet.setAnimationListener(new Animation.AnimationListener(localLayoutParams) {
            public void onAnimationStart(Animation paramAnimation) {}

            public void onAnimationRepeat(Animation paramAnimation) {}

            public void onAnimationEnd(Animation paramAnimation) {
                if (a.n(a.this) == null)
                    return;
                if ((a.a(a.this) == 12) || (a.a(a.this) == 11))
                    return;
                if (a.a(a.this) == 31)
                    a.a(a.this, 11);
                else
                    a.a(a.this, 12);
                a.n(a.this).clearAnimation();
                this.b.leftMargin = 0;
                a.n(a.this).setLayoutParams(this.b);
            }
        });
        this.k.startAnimation(localAnimationSet);
    }

    private boolean v() {
        return (!(e.a(this.s)));
    }

    public boolean d() {
        if (this.o == null)
            return false;
        return (this.o.getVisibility() == 0);
    }

    private void w() {
        if (((this.u != 61) && (this.u != 62)) || (!(v())))
            return;
        if ((this.o != null) && (this.o.getVisibility() == 0) && (this.m != null)) {
            this.o.d();
            if (this.u == 61) {
                if (this.o.e()) {
                    this.o.c();
                    this.m.setVisibility(8);
                    this.u = 11;
                    if (this.r != null)
                        this.r.c();
                    if (this.p != null)
                        this.p.setVisibility(8);
                }
            }
            else if (this.o.f()) {
                this.o.c();
                this.m.setVisibility(8);
                this.u = 12;
                if (this.r != null)
                    this.r.c();
                if (this.p != null)
                    this.p.setVisibility(8);
            }
        }
        if ((this.r == null) || (this.r.getVisibility() != 0) || (this.p == null))
            return;
        this.r.d();
        if (this.u == 61) {
            if (!(this.r.e()))
                return;
            this.r.c();
            this.p.setVisibility(8);
        }
        else {
            if (!(this.r.f()))
                return;
            this.r.c();
            this.p.setVisibility(8);
        }
    }

    private void x() {
        if (this.K)
            return;
        if (((this.u != 51) && (this.u != 52)) || (!(v())))
            return;
        if ((this.i == null) || (this.c == null) || (this.k == null) || (this.d == null))
            return;
        i();
        if ((this.o == null) || (this.o.getVisibility() == 0))
            return;
        a(1.0F);
        if (this.u == 51)
            this.n.x = this.i.x;
        else
            this.n.x = (this.d.x - this.n.width + this.e);
        this.n.y = this.i.y;
        this.m.setVisibility(0);
        this.c.updateViewLayout(this.m, this.n);
        FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(-1, -1);
        localLayoutParams.gravity = 51;
        localLayoutParams.leftMargin = 0;
        localLayoutParams.topMargin = 0;
        this.o.setLayoutParams(localLayoutParams);
        this.o.a(this.u);
        if (this.u == 51)
            this.o.b();
        else
            this.o.a();
    }

    private void a(float paramFloat) {
        if ((this.l == null) || (this.x == paramFloat))
            return;
        this.l.clearAnimation();
        AlphaAnimation localAlphaAnimation = null;
        localAlphaAnimation = new AlphaAnimation(this.x, paramFloat);
        this.x = paramFloat;
        localAlphaAnimation.setDuration(300L);
        AnimationSet localAnimationSet = new AnimationSet(false);
        localAnimationSet.addAnimation(localAlphaAnimation);
        localAnimationSet.setFillAfter(true);
        localAnimationSet.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation paramAnimation) {}

            public void onAnimationRepeat(Animation paramAnimation) {}

            public void onAnimationEnd(Animation paramAnimation) {}
        });
        this.l.startAnimation(localAnimationSet);
    }

    private void y() {
        if ((this.k == null) || (this.q != null) || (this.p != null) || (this.n == null) || (this.k == null))
            return;
        this.q = g();
        this.p = new GameunionFloatingIconMoreMenu(this.b);
        this.r = ((MoreMenuIconManager) this.p.findViewById(com.qihoo.gamecenter.sdk.suspend.d.b.f));
        this.r.setVisibility(8);
        this.r.a(this, this.s, this.g);
        this.q.width = this.n.width;
        this.q.height = this.n.height;
        this.c.addView(this.p, this.q);
    }

    private void z() {
        this.w = System.currentTimeMillis();
        if ((this.c == null) || (this.d == null) || (this.n == null))
            return;
        y();
        if ((this.r == null) || (this.r.getVisibility() == 0))
            return;
        int i1 = this.r.a(this.k.getHeight(), this.k.getWidth());
        this.q.width = (i1 + this.k.getWidth());
        this.q.x = this.n.x;
        if (this.n.y + this.n.height * 2 > this.d.y)
            this.q.y = (this.n.y - this.n.height);
        else
            this.q.y = (this.n.y + this.n.height);
        if ((this.u == 52) || (this.u == 12))
            this.q.x = (this.d.x - this.q.width + this.e);
        this.p.setVisibility(0);
        this.c.updateViewLayout(this.p, this.q);
        FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(-1, -1);
        localLayoutParams.gravity = 51;
        localLayoutParams.leftMargin = 0;
        localLayoutParams.topMargin = 0;
        this.r.setLayoutParams(localLayoutParams);
        this.r.a(this.u);
        if (this.u == 51)
            this.r.b();
        else
            this.r.a();
    }

    public void a(int paramInt) {
        if (this.f == null)
            return;
        this.f.a(paramInt);
    }

    public static class a {
        public float a = 0.0F;
        public float b = 0.0F;
    }
}